﻿<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true"
    CodeFile="AdvertisementListManagement.aspx.cs" Inherits="Page_AdvertisementListManagement" %>

<%@ Register Src="UserControl/ContentHeader.ascx" TagName="ContentHeader" TagPrefix="uc1" %>
<%@ Register Src="UserControl/Message.ascx" TagName="Message" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%= TextBox_StartDate.ClientID %>").datepicker();
            $("#<%= TextBox_EndDate.ClientID %>").datepicker();
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <uc1:ContentHeader ID="ContentHeader1" PageTitle="Advertising list management" runat="server"
        GoToLabel="Add new ads" GoToLink="AddEditAdvertisement.aspx" />
    <div class="body_content">
        <uc2:Message ID="Message_Alert" runat="server" />
        <asp:UpdateProgress ID="UpdateProgress_Main" AssociatedUpdatePanelID="UpdatePanelContent"
            runat="server" DynamicLayout="true" DisplayAfter="0">
            <ProgressTemplate>
                <div class="overlay">
                    <div class="loader">
                        <img id="Img1" runat="server" alt="Loading..." src="../App_Themes/img_data/loading.gif"
                            width="25" />
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanelContent" runat="server" OnLoad="UpdatePanelContent_Load">
            <ContentTemplate>
                <div id="searchpanel" class="df_tbl_func_row">
                    <div class="formrow">
                        <label class="lb_small fl">
                            <%= Resources.News.Keyword%></label>
                        <div class="form_filed fl">
                            <asp:TextBox ID="TextBox_Title" CssClass="textbox_small" runat="server"></asp:TextBox></div>
                        <div class="form_filed fl">
                            <asp:DropDownList ID="DropDownList_Category" runat="server" CssClass="select">
                            </asp:DropDownList>
                        </div>
                        <div class="form_filed fl">
                            <asp:DropDownList ID="DropDownList_Position" runat="server" CssClass="select">
                            </asp:DropDownList>
                        </div>
                        <div class="form_filed fl">
                            <asp:DropDownList ID="DropDownList_Status" runat="server" CssClass="select">
                                <asp:ListItem Selected="True" Text="--All Status --" Value=""></asp:ListItem>
                                <asp:ListItem Text="Activated" Value="1"></asp:ListItem>
                                <asp:ListItem Text="Inactive" Value="0"></asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div class="form_filed fl">
                            <label class="lb fl">
                                <%= Resources.Advertisement.StartDate%></label>
                            <asp:TextBox ID="TextBox_StartDate" CssClass="textbox_smaller" runat="server"></asp:TextBox>
                        </div>
                        <div class="form_filed fl">
                            <label class="lb fl">
                                <%= Resources.Advertisement.EndDate%></label>
                            <asp:TextBox ID="TextBox_EndDate" CssClass="textbox_smaller" runat="server"></asp:TextBox>
                        </div>
                        <div class="df_ibtn fl">
                            <asp:Button ID="Button_Search" runat="server" Text="Search" OnClick="Button_Search_Click" />
                        </div>
                        <div class="df_ibtn fl">
                            <asp:Button ID="Button_Cancel" runat="server" Text="Refresh" OnClick="Button_Cancel_Click" />
                        </div>
                        <div class="clr">
                        </div>
                    </div>
                </div>
                <asp:Literal ID="Literal_PagingListTop" runat="server"></asp:Literal>
                <table width="100%" cellspacing="0" cellpadding="0" class="df_table">
                    <tr>
                        <th>
                            Advertisement Name
                        </th>
                        <th style="width: 5%">
                            Category
                        </th>
                        <th style="width: 10%">
                            Advertisement Position
                        </th>
                        <th style="width: 6%" class="center">
                            Image
                        </th>
                        <th style="width: 10%" class="center">
                            Link
                        </th>
                        <th style="width: 5%" class="center">
                            Created Date
                        </th>
                        <th style="width: 5%" class="center">
                            Start Date
                        </th>
                        <th style="width: 4%" class="center">
                            End Date
                        </th>
                        <th style="width: 3%" class="center">
                            Status
                        </th>
                        <th style="width: 3%" class="center">
                        </th>
                    </tr>
                    <asp:Repeater runat="server" ID="Repeater_Content" OnItemCommand="Repeater_Content_ItemCommand">
                        <ItemTemplate>
                            <tr class="<%# Container.ItemIndex % 2 == 0 ? "odd" : "even" %>">
                                <td>
                                    <%# Eval("Name")%>
                                </td>
                                <td>
                                    <%# EasyCode.Utility.Protector.String(Eval("AdvertisementCategory.AdvCatName"))%>
                                </td>
                                <td>
                                    <%# EasyCode.Utility.Protector.String(Eval("AdvertisementPosition.Name"))%>
                                </td>
                                <td align="center">
                                    <%# string.IsNullOrEmpty(EasyCode.Utility.Protector.String(Eval("FileLink1"))) ? "" : "<img style=\"cursor: pointer;\" src=\"../App_Themes/img_data/i_photo.gif\" onmouseout=\"UnTip();\" onmouseover=\"Tip('<img src=" + ResolveUrl(EasyCode.Utility.Protector.String(Eval("FileLink1"))) + " width=100 />',BGCOLOR, '#ffffff', BORDERCOLOR, '#cccccc', BORDERWIDTH, 1, WIDTH, 'auto', FONTCOLOR,'#58792E')\" alt=\"\" />"%>
                                </td>
                                <td align="center">
                                    <%# EasyCode.Utility.Protector.String(Eval("Link"))%>
                                </td>
                                <td align="right">
                                    <%# EasyCode.Utility.Protector.DateTime(Eval("Created_At")).ToShortDateString()%>
                                </td>
                                <td align="right">
                                    <%# EasyCode.Utility.Protector.DateTime(Eval("StartTime")).ToShortDateString()%>
                                </td>
                                <td align="right">
                                    <%# EasyCode.Utility.Protector.DateTime(Eval("EndTime")).ToShortDateString()%>
                                </td>
                                <td align="center">
                                    <asp:LinkButton runat="server" ID="LinkButton_ChangeStatus" ToolTip='Change this item status'
                                        OnClientClick='return ConfirmAction("Are you sure you want to change the selected item status?");'
                                        CommandName="LockUnLockCommand" CommandArgument='<%# Eval("Id") %>'>
                                    <%# EasyCode.Utility.Protector.Bool(Eval("flag"), false) ? "<img src='../App_Themes/themes/default/images/func_icons/checked.png' alt='' />" : "<img src='../App_Themes/themes/default/images/func_icons/uncheck.png' alt='' />"%>
                                    </asp:LinkButton>
                                </td>
                                <td class="center">
                                    <asp:HyperLink runat="server" ID="LinkButton_Edit" ToolTip='Edit' NavigateUrl='<%# "AddEditAdvertisement.aspx?id=" + Eval("Id")%>'
                                        CssClass="edit_icon"></asp:HyperLink>
                                    <asp:LinkButton runat="server" ID="LinkButton_Delete" ToolTip="Delete" CommandName="DeleteCommand"
                                        CssClass="del_icon" CausesValidation="false" CommandArgument='<%# Eval("Id") %>'
                                        OnClientClick='return ConfirmAction("Are you sure you want to permanently delete the selected item?");'></asp:LinkButton>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr runat="server" id="tr_not_found" visible="false">
                        <td colspan="6">
                            Data not found.
                        </td>
                    </tr>
                </table>
                <asp:Literal ID="Literal_PagingListBot" runat="server"></asp:Literal>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <script type="text/javascript">
        function loadpage(page) {
            __doPostBack('<%= UpdatePanelContent.ClientID %>', page + '|page');
        }
        function ConfirmAction(message) {
            return confirm(message);
        }
    </script>
</asp:Content>
